package org.com.platform.config;

import org.flowable.ui.common.conf.DevelopmentConfiguration;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

import javax.sql.DataSource;

/**
 * 数据库配置文件
 * @ClassName DevelopmentConfiguration
 * @Description TODO
 * @Author SuperMen
 * Date 2019/1/11 17:32
 * @Version 1.0
 **/
@Configuration
public class DevelopmentConfigurationSelf extends DevelopmentConfiguration {
    protected static final String DATASOURCE_DRIVER_CLASS_NAME = "com.mysql.jdbc.Driver";
    protected static final String DATASOURCE_URL = "jdbc:mysql://180.76.159.181:12345/flowable?characterEncoding=UTF-8&useSSL=false";
    protected static final String DATASOURCE_USERNAME = "root";
    protected static final String DATASOURCE_PASSWORD = "taoding123456";

    @Bean
    @Primary
    @Override
    public DataSource developmentDataSource() {
        return DataSourceBuilder
                .create()
                .driverClassName(DATASOURCE_DRIVER_CLASS_NAME)
                .url(DATASOURCE_URL)
                .username(DATASOURCE_USERNAME)
                .password(DATASOURCE_PASSWORD)
                .build();
    }
}
